package com.example.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.entity.ArticleFavorites;
import com.example.mapper.ArticleFavoritesMapper;
import com.example.service.ArticleFavoritesService;
import org.springframework.stereotype.Service;

@Service
public class ArticleFavoritesServiceImpl extends ServiceImpl<ArticleFavoritesMapper, ArticleFavorites> implements ArticleFavoritesService {

    @Override
    public boolean deleteByUserIdAndArticleId(Integer userId, Integer articleId) {
        return remove(Wrappers.<ArticleFavorites>lambdaQuery()
                .eq(ArticleFavorites::getUserId, userId)
                .eq(ArticleFavorites::getArticleId, articleId));
    }
}
